package com.ghost.alibabaghost.dao.mapper.sys;

import com.ghost.alibabaghost.dao.dataobject.sys.SysRoleDO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author lishengyao
 */
@Mapper
public interface SysRoleMapper {

    /**
     * 根据ID查询
     *
     * @param id
     * @return
     */
    @Select("SELECT id,name,remarks FROM sys_role WHERE id = #{id}")
    SysRoleDO selectById(Integer id);

    /**
     * 查询全部
     *
     * @return
     */
    @Select("select id,name,remarks from sys_role")
    List<SysRoleDO> queryAll();

    /**
     * 查询全部
     *
     * @return
     */
    @Delete("delete from sys_role where id = #{id}")
    Integer deleteById(Integer id);

    /**
     *
     * @param sysRoleDO
     * @return
     */
    @Insert("insert into sys_role(name,remarks) values(#{name},#{remarks})")
    Integer saveRole(SysRoleDO sysRoleDO);

    /**
     *
     * @param sysRoleDO
     * @return
     */
    @Update("update sys_role set name = #{name},remarks=#{remarks} where id = #{id}")
    Integer updateRole(SysRoleDO sysRoleDO);

}
